import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import moment from 'moment';
import {
    Row, Col, Card, Form, Input, Select, Icon,
    Button, Dropdown, Menu, InputNumber,
    DatePicker, Modal, message, Badge, Table,
    Divider, Tag, Tree, Tooltip,
} from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import { routerRedux } from 'dva/router';
import DescriptionList from '../../components/DescriptionList';
import styles from './AddGroup.less';

/*
 组织架构添加组织界面
*/
const { Description } = DescriptionList;
const { TextArea } = Input;
const { Option, OptGroup } = Select;

@connect(({ loan }) => ({
    loan,
}))
@Form.create()
export default class AddGroup extends PureComponent {
    state = {
    };
    onSelect = (selectedKeys, info) => {
        console.log('selected', selectedKeys, info);
    }

    handleChange = (value) => {
        console.log(`selected ${value}`);

    }
    handleAddJobs = () => {
        // const { dispatch } = this.props;
        this.props.dispatch(routerRedux.push('/system/post-maintenance'));
    }

    render() {
        // const { dispatch } = this.props;
        return (
            <PageHeaderLayout title="添加组织">
                <Card
                    bordered={false} >
                    <DescriptionList style={{ marginBottom: 42 }} col={2}>
                        <Description term="组织名称">
                            <Input placeholder="请输入" />
                        </Description >
                    </DescriptionList>
                    <DescriptionList style={{ marginBottom: 52 }} col={2}>
                        <Description term="上级组织">
                            <Row>
                                <Select
                                    defaultValue="1"
                                    style={{ width: '100%' }}
                                    onChange={this.handleChange}
                                >
                                    <OptGroup label="省行">
                                        <Option value="1">武汉分行</Option>
                                        <Option value="2">黄石分行</Option>
                                    </OptGroup>
                                </Select>
                            </Row>
                        </Description >
                    </DescriptionList>
                    <DescriptionList style={{ marginTop: 42 }} col={2}>
                        <Description term="备注">
                            <Row>
                                <TextArea placeholder="请输入" rows={4} />
                            </Row>
                        </Description >
                    </DescriptionList>
                    <div className={styles.tableListOperator}>
                        <Button style={{ marginTop: 50 }} type="primary" onClick={() => this.handleAddJobs()}>
                            提交
                      </Button>
                    </div>
                </Card>
            </PageHeaderLayout>
        );
    }
}